package utils;


import java.io.IOException;
import java.io.InputStream;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * 
* @ClassName: PropertyUtil
* @Description: 获取PROPERTY数据
* @author chenchao
* @date 2013-12-4 上午05:02:28
*
 */
public class PropertyUtil {
	
	private static Map<String,String> propertiesMap = new HashMap<String, String>();

	/**
	 * 获取PROPERTIES中的数据
	 * @param is 文件对象
	 * @return 数据集合对象MAP
	 */
	public static Map<String,String>  getPropertiesData(InputStream is) {
		try {
			Properties p = new Properties() ;
			p.load(is);
			Enumeration<String> keys = (Enumeration<String>)p.propertyNames();
			while(keys.hasMoreElements()) {
				String key = keys.nextElement();
				propertiesMap.put(key, p.getProperty(key));
			}
		} catch (IOException e) {
			e.printStackTrace();
		}
		
		return propertiesMap;
		
	}
	
}
